<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglib.jsp" %>    
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

	<script>
		//# sourceURL=roleForm.js

		function submitSuccess() {
		 	//alert("hello: " + $("#roleForm").serialize());
			$.post("${ctx}/org/role/${actionName}.action",
				$("#roleForm").serialize(),
				function(data, status){
					if (data == 'success') {
						dialogSubmitSuccess();
						return;
					} else {
						alert("错误: \n" + data);
					}
				}
			).success(function() { 
				//alert("submitForm success"); 
			})
			.error(function(xmlHttpRequest, textStatus, errorThrown) { 
				  alert("异常： " + xmlHttpRequest.status + ":" + errorThrown);
			})
			.complete(function() { 
				//alert("submitForm complete"); 
			});	

		}
	</script>

</head>

<body>

<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
		&times;
	</button>
	<h4 class="modal-title">
		<c:choose>
			<c:when test="${actionName == 'add'}">新建角色</c:when>
			<c:otherwise>修改角色</c:otherwise>
		</c:choose>		
	</h4>
</div>

<div class="modal-body">
	<form:form modelAttribute="role" id="roleForm" class="form-horizontal" role="form" method="post">
		<form:hidden path="appId"/>
		<form:hidden path="roleId"/>
		
		<div class="form-group">
			<label for="roleName" class="col-sm-2 control-label">*名称</label>
			<div class="col-sm-10">
				<form:input path="roleName" class="form-control"/>
			</div>
		</div>

		<div class="form-group">
			<label for="description" class="col-sm-2 control-label">描述</label>
			<div class="col-sm-10">
				<form:input path="description" class="form-control"/>
			</div>
		</div>		

	</form:form>
</div>

<div class="modal-footer">	
	<button type="button" class="btn btn-primary" onclick="submitSuccess();">确定</button>
	<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>	
</div>
   	
</body>
</html>